-
Notifications
You must be signed in to change notification settings - Fork 842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Page Layouts] Created EuiPageTemplate to facilitate the new design patterns for page layouts #4525
Conversation
# Conflicts: # src-docs/src/components/guide_page/guide_page.js # src-docs/src/views/home/home_view.js
# Conflicts: # src-docs/src/images/button_popover.svg
# Conflicts: # src-docs/src/components/guide_components.scss
# Conflicts: # src-docs/src/components/guide_section/_guide_section.scss # src-docs/src/components/guide_section/guide_section_parts/guide_section_code.tsx
But sticky isn’t working inside the page
And created template versions of all the doc examples
# Conflicts: # src/components/index.js
Co-authored-by: Dave Snider <dave.snider@gmail.com>
I think it's odd to hide cards at certain page sizes. I think we just need to add more at some point 😄
Actually this failure from negative margins of the lower gray box ... EDIT: And I know how to fix now actually
I'm hoping NOT to wait on the other PR for long. So I'd like to stick with this usage as it's using the inherent tabs prop of EuiPageHeader to showcase specifically how that works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Reasons to stick with with these decisions make sense to me knowing we have another PR coming soon. Nice work. Huge change!
Preview documentation changes for this PR: https://eui.elastic.co/pr_4525/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4525/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't look too closely at the docs changes, but the new component changes look ready to go
Just a couple changes for TS and CL
CHANGELOG.md
Outdated
@@ -23,9 +23,26 @@ | |||
|
|||
- Removed letter-spacing from `euiFont` Sass mixin ([#4488](https://github.com/elastic/eui/pull/4488)) | |||
|
|||
### Feature: EuiPageTemplate ([#4517](https://github.com/elastic/eui/pull/4517)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a release in the meantime. Need to update the location.
const onMenuButtonClick: MouseEventHandler<HTMLButtonElement> = (e) => { | ||
// @ts-ignore HELP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const onMenuButtonClick: MouseEventHandler<HTMLButtonElement> = (e) => { | |
// @ts-ignore HELP | |
const onMenuButtonClick: MouseEventHandler< | |
HTMLButtonElement & HTMLAnchorElement | |
> = (e) => { |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4525/ |
Jenkins, test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4525/ |
Jenkins, test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4525/ |
Jenkins, test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4525/ |
... And updated the EUI docs to use the new pattern.
Component updates/additions
EuiPage
grow
: To easily facilitate allowing the whole page to stretch to fit vertically.direction
: Changes theflex-direction
property. Originally added because I wanted to remove theEuiPageBody
dependency, but found the EuiPageBody to be a better solution. Leaving it in, just as a nice solution for others.EuiPageBody
panelled
: Uses an EuiPanel as the main component instead of a plain divpanelProps
: Extends any extra EuiPanel props ifpanelled=true
paddingSize
: For changes to overall padding for both EuiPanel and plain divEuiPageContent
Fix: I'm pretty sure I fixed the overflowing of content when the EuiPageContent component is a flex item next to EuiSideBar by adding
min-width: 0
.EuiPageContentBody
restrictWidth
: Aligns with all other EuiPage componentrestrictWidth
propspaddingSize
: Also to align with all other EuiPage component padding sizesEuiPageHeader
paddingSize
to align with all other EuiPage component padding sizesEuiPageHeaderContent
large
size.EuiPageSideBar
$euiPageSidebarMinWidth
global token for updating the hard-coded min-widthsticky
for easily allowing the sidebar to scroll independently of the page contents. TheeuiHeaderAffordForFixed()
Sass mixin now also applies any extra styling to.euiSideBar--sticky
to afford for any fixed headers.[NEW] EuiPageTemplate
Similar to the EuiSelectableSitewideTemplate component this new EuiPageTemplate component is a shortcut for creating the different types of page layout patterns described in the docs. It is somewhat opinionated, but still with the ability to customize most of the inner components with props like
sideBarProps
andpageContentProps
.This template may not be complete at this time, but provides solutions with a quick way to opt in to the new layout patterns. And fixes #3743
Example. This simple React usage:
Will render as:
Four types of
templates
As of right now there are 4 template types, all with/without
sideBar
s:'default' | 'centeredBody' | 'centeredContent' | 'empty'
. The example above is thedefault
. The centered options allow for either the whole body or just the content to be centered depending, usually, on which part is the "empty" state.centeredBody
centeredContent
empty
Good for more free-form body content like dashboards.
Padding size and max-widths
Both the
restrictWidth
andpaddingSize
props can be applied as this top layer and will apply them to all the appropriate inner components. It also defaults therestrictWidth
totrue
so that most layouts are automatically maxed.Other component fixes
EuiBreadcrumbs truncation
Since I re-discovered the
min-width: 0
trick for flex items and noticed that long header breadcrumbs were breaking the header layouts, I added this directly to the EuiBreadcrumb component.EuiHeaderSectionItemButton only rendered a
<button>
These buttons weren't accepting
href
's like I needed for the docs updates with putting the github and design library links in the header. Now the component just extends EuiButtonEmpty to easily get all the states and types necessary for allowing bothonClick
andhref
.This also removed the specific
:hover
states to be more inline with our empty button behavior which has none.Docs updates/additions
Added an EuiHeader to house the theme switcher and other links that previously only existed on the home page
I've also made the design library and codesandbox links theme aware. Meaning, depending on the currently selected theme, it will update these library links to point to that theme's library and the codesandbox link will import the corresponding CSS file.
Added the ability to create custom demo tabs
For these new EuiPage docs, I really wanted to show both how to use the template version and how to create the same layout manually with the corresponding components. I could have used the
Demo JS
andSnippet
tabs for this, but I wanted to be more explicit than that. I also wanted to be able to have all the import statements for both (which Snippets do not automatically come with).So now you can pass something like the following into the
source
key of the guide section, and it will render similar to our currentDemo JS
tab but with a custom tabdisplayName
.The tabs will also now render in the order they're given in the
source
.Updated the home page 😸
Follow-ups
There are still a few minor things to work out like:
<main>
Checklist (Still working on most of these)
[ ] Checked for breaking changes and labeled appropriately